package org.willa.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.willa.business.sys.entity.SysUser;
import org.willa.config.redis.RedisCache;
import org.willa.system.mapper.SysDictMapper;
import org.willa.system.mapper.SysUserMapper;
import org.willa.system.service.ITestService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * @author wuwei
 * @date 2023/12/24
 * @apiNote
 */
@Service
public class TestServiceImpl extends ServiceImpl<SysUserMapper, SysUser>  implements ITestService {

    @Resource
    private SysUserMapper sysUserMapper;

    @Resource
    private SysDictMapper sysDictMapper;
    @Resource
    private RedisCache redisCache;

    @Override
    public String testRedis() {
        redisCache.setCacheObject("testRedis", "test");
        Object testRedis = redisCache.getCacheObject("testRedis");
        return Objects.toString(Objects.isNull(testRedis));
    }

    @Override
    public List<SysUser> testMapper() {
        return sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().eq(SysUser::getId,0));
    }
}
